﻿using UnityEngine;
using System.Collections;

public class FollowTarget : MonoBehaviour {
	
	public Transform target;
	
	public bool lockXAxis;
	public bool lockYAxis;
	public bool lockZAxis;
	
	Vector3 moveVector;
	// Update is called once per frame
	void Update () {
		if(target == null)
			return;
		
		moveVector = transform.localPosition;
		if(!lockXAxis)
			moveVector.x = target.localPosition.x;
		if(!lockYAxis)
			moveVector.y = target.localPosition.y;
		if(!lockZAxis)
			moveVector.z = target.localPosition.z;
		transform.localPosition = moveVector;
	}
}
